import JavaScriptCore

@objc protocol MyJSExport: JSExport {
    static func greet(name: String) -> String
}

class SwiftClass: NSObject, MyJSExport {
    @objc static func greet(name: String) -> String {
        return "Hello \(name)"
    }
}
    
let context = JSContext()
context?.setObject(SwiftClass.self, forKeyedSubscript: "SwiftClass" as (NSCopying & NSObjectProtocol))
let result: String! = context?.evaluateScript("SwiftClass.greet({name:'World'})").toString()
print(result!)